<?php
	$currentItem = "NewsAdmin";
?>
<include file="./Tpl/default/Admin/Public/header.html" />
<include file="./Tpl/default/Admin/Public/sidebar.html" />

<!--ThinkPHP Ajax-->
<!--<load href="../Public/Js/Base.js" />-->
<!--<load href="../Public/Js/prototype.js" />-->
<!--<load href="../Public/Js/mootools.js" />-->
<!--<load href="../Public/Js/Ajax/ThinkAjax.js" />-->


<!--kindeditor-->
<script charset="utf-8" src="../Public/editor/kindeditor.js">
</script>

<script>
	KE.show({
	    id : 'message'
	});

</script>

<!--ThinkPHP Ajax-->
<!--<script language="JavaScript">-->
<!---->
<!--	//Ajax添加新闻-->
<!--	function updateCommit(){-->
<!--		KE.util.setData('message');-->
<!--		ThinkAjax.sendForm('NewsForm','__APP__/Admin/NewsAdmin/updateCommit',complete,'result');-->
<!--	}-->
<!--	-->
<!--	//添加新闻成功后的回调事件-->
<!--	function complete(data,status){-->
<!--		if (status==1)-->
<!--		{-->
<!--			// 更新列表-->
<!--			htmlstring = '更新成功！ ';-->
<!--			alert(htmlstring);-->
<!--		}-->
<!--	}-->
<!--	-->
<!-- </script>-->


<!--添加文件上传的input-->
<script language="JavaScript">
	function addFileInput(){
		var newInput = document.createElement("input");
		newInput.type='file'; 
		newInput.name="affixFiles[]"; 
		
		var isFileInput = document.createElement("input");
		isFileInput.type='hidden'; 
		isFileInput.name="isFile";
		isFileInput.value="true";
				
		var fileDiv =document.getElementById("fileDiv")
		fileDiv.appendChild(newInput); 
		fileDiv.appendChild(isFileInput); 
	}
</script>

<div>
	<h2>修改新闻页面</h2>
	
	<br>
	
	
	<form id="NewsForm" method="post" action="__APP__/Admin/NewsAdmin/updateCommit" enctype="multipart/form-data">
<!--		<div id="result" style="font-family:微软雅黑,Tahoma;letter-spacing:2px">-->
<!--		</div>-->
		<ul>

			<li>
				<label>选择发布的新闻类型</label>
				<select name="type">
					<option value="0" <?php if($news['type'] == 0) echo 'selected'?> >学院要闻</option>
					<option value="1" <?php if($news['type'] == 1) echo 'selected'?>>招聘信息</option>
					<option value="2" <?php if($news['type'] == 2) echo 'selected'?>>学生风采</option>			
				</select>	
			
			</li>
			
			<li>
				<label>标题：</label>
				<input type="text" name="title" value="<?php echo $news['title']?>" style="width:300px">
			</li>
			
			<li>
				<label>副标题：</label>
				<input type="text" name="subtitle" value="<?php echo $news['subtitle']?>" style="width:400px">
			</li>
			
			<!--	输出新闻的附件		-->
			<?php 
				if($newsAffixList != null){
					foreach ($newsAffixList as $vo){
			?>
				{$vo['filename']}
				<a href="__APP__/Admin/NewsAdmin/deleteAffix/news_id/{$news['news_id']}/affix_id/{$vo['affix_id']}">删除</a>
				<br>
			<?php
						}
				}
			?>
			<!--	End 输出新闻的附件		-->
			
			<li>
				<div id="fileDiv">
					<input type="button" onclick="addFileInput()" value="添加附件">
				</div>
			</li>
			
			
			<li>
				
				<textarea id="message"
						  name="message"
						  style="width:700px;height:300px;"
						  >
			 		   <?php
			 		   		echo $news['message'];
			 		   ?>
			 		     
			 	</textarea>			
			</li>

			<li>
				<input type="hidden" value="<?php echo $news['news_id']?>" name="news_id">	
<!--				<input type="hidden" name="ajax" value="1">-->
<!--				<input type="button" onClick="updateCommit()" value="更新提交">-->

				<input  type="submit" value="提交更新">
				<strong><a href="__APP__/Admin/NewsAdmin">返回</a></strong>
				
			</li>
			
		</ul>

	</form>

</div>

<include file="./Tpl/default/Admin/Public/footer.html" />


